package com.gsafety.wellsfort.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gsafety.wellsfort.common.enums.CustomerTypeEnum;
import com.gsafety.wellsfort.domain.model.knowledge.KnowledgePoint;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

@Data
public class KnowledgePointVO {
    private Integer id;

    @ApiModelProperty(value = "知识点对象")
    private Integer objectType;

    @ApiModelProperty(value = "知识点对象名称")
    private String objectTypeText;

    @ApiModelProperty(value = "知识点标题")
    private String title;

    @ApiModelProperty(value = "知识点关键字")
    private String keyword;

    @ApiModelProperty(value = "知识点内容")
    private String content;

    @ApiModelProperty(value = "启用禁用状态")
    private Byte isOpen;


    @ApiModelProperty(value = "修改人")
    private Integer modified;

    @ApiModelProperty(value = "修改人名称")
    private String modifiedName;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
    public static  class VOBuilder{
        KnowledgePoint knowledgePoint;
        KnowledgePointVO knowledgePointVO =new KnowledgePointVO();
        public VOBuilder(KnowledgePoint q){
            this.knowledgePoint =q;
        }
        public KnowledgePointVO build(){
            BeanUtils.copyProperties(knowledgePoint, knowledgePointVO);
            knowledgePointVO.setObjectTypeText(CustomerTypeEnum.parseVal(knowledgePointVO.getObjectType()).label);
            return knowledgePointVO;
        }
    }
}